package com.zbdx.service.impl;

import com.zbdx.dao.SelProductDao;
import com.zbdx.dao.impl.SelProductDaoImpl;
import com.zbdx.domain.product;
import com.zbdx.service.SelProductService;

import java.sql.SQLException;
import java.util.List;

/**
 * @version 1.0
 * @Auther 樊航宇
 * @Date 2024/9/15 17:00
 * @注释
 */
public class SelProductServiceImpl implements SelProductService {

    private SelProductDao selProductDao = new SelProductDaoImpl();

    /**
     * 根据Type查询商品
     * @param type
     * @return
     */
    @Override
    public List<product> findAllProductbyType(String type) throws SQLException {
        List<product> productList = selProductDao.selAllProduct(type);
        return productList;
    }

    /**
     * 根据Type查询销量前10的各个类型的商品
     *
     * @param ptype
     */
    @Override
    public List<product> findHeadProductbyType(String ptype) throws SQLException {
        List<product> productList = selProductDao.selHeadProduct(ptype);
        return productList;
    }
}
